{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cf909ce3",
   "metadata": {},
   "source": [
    "# 第一题\n",
    "+ **要求**：利用for循环，将列表中的所有人名修改成大写格式，并把结果放在name_ans_list中。如“jack”修改成“JACK”"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e318c5af",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['ORVA',\n",
       " 'STRAWBERRY',\n",
       " 'BELOVED',\n",
       " 'ZERA',\n",
       " 'SEAN',\n",
       " 'GUIDE',\n",
       " 'OLAF',\n",
       " 'JOCELYN',\n",
       " 'DERMOT',\n",
       " 'RITA',\n",
       " 'BETTINA',\n",
       " 'FLOWER',\n",
       " 'FRESH',\n",
       " 'FARA',\n",
       " 'EMILY',\n",
       " 'EVAN',\n",
       " 'DARK',\n",
       " 'PENELOPE',\n",
       " 'HUBERT',\n",
       " 'NOLA']"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_list=['Orva',\n",
    "'Strawberry',\n",
    "'Beloved',\n",
    "'Zera',\n",
    "'Sean',\n",
    "'Guide',\n",
    "'Olaf',\n",
    "'Jocelyn',\n",
    "'Dermot',\n",
    "'Rita',\n",
    "'Bettina',\n",
    "'Flower',\n",
    "'Fresh',\n",
    "'Fara',\n",
    "'Emily',\n",
    "'Evan',\n",
    "'Dark',\n",
    "'Penelope',\n",
    "'Hubert',\n",
    "'Nola']\n",
    "name_ans_list=[]\n",
    "for i in name_list:\n",
    "    name_ans_list.append(i.upper())\n",
    "name_ans_list"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "749ed861",
   "metadata": {},
   "source": [
    "# 第二题\n",
    "+ **要求**：请在代码的out部分输出如下图形"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "0914333f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   *\n",
      "  ***\n",
      " *****\n",
      "*******\n",
      " *****\n",
      "  ***\n",
      "   *\n"
     ]
    }
   ],
   "source": [
    "#    *\n",
    "#   ***\n",
    "#  *****\n",
    "# *******\n",
    "#  *****\n",
    "#   ***\n",
    "#    *\n",
    "for i in range(1,8,2):\n",
    "    print(\" \"*int((7-i+1)/2)+\"*\"*i)\n",
    "for i in range(5,0,-2):\n",
    "    print(\" \"*int((7-i+1)/2)+\"*\"*i)\n",
    "\n",
    "\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3ffaa969",
   "metadata": {},
   "source": [
    "# 第三题\n",
    "+ **要求**：定义两个输入语句，获得两个变量，程序可以自动识别两个变量之间的关系.<br>\n",
    "例如输入a=8,b=9 返回结果“a<9”"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "84d2c2a8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入第一个数：3\n",
      "输入第二个数：4\n"
     ]
    },
    {
     "ename": "AttributeError",
     "evalue": "'str' object has no attribute 'b'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-26-48a053b37974>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[0mb\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'输入第二个数：'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      3\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0ma\u001b[0m\u001b[1;33m<\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 4\u001b[1;33m     \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'a<b'\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m==\u001b[0m\u001b[0mint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      5\u001b[0m \u001b[1;32melif\u001b[0m \u001b[0ma\u001b[0m\u001b[1;33m>\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      6\u001b[0m     \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'a>b'\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m==\u001b[0m\u001b[0mint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0minput\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mAttributeError\u001b[0m: 'str' object has no attribute 'b'"
     ]
    }
   ],
   "source": [
    "a=int(input('输入第一个数：'))\n",
    "b=int(input('输入第二个数：'))\n",
    "if a<b:\n",
    "    print('a<b'.b==int(input()))\n",
    "elif a>b:\n",
    "    print('a>b'.b==int(input()))\n",
    "else: \n",
    "    print('a=b'.b==int(input()))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e2fbf130",
   "metadata": {},
   "source": [
    "# 第四题\n",
    "+ **要求**：定义一个函数，可以在输入半径的情况下求解圆的面积（保留两位小数）。例如：输入半径为1，返回3.14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "c0098cb5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "输入圆的半径：3\n",
      "面积为：28.27\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "r=input('输入圆的半径：')\n",
    "s=int(r)**2*(math.pi)\n",
    "print('面积为：{:.2f}'.format(s))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
